var qqcs;

$(function () {
    //初始化表格
    initTable();
    //查询数据
    queryGwLb();
});

function initTable() {
    // 主表格
    var fields = [[{
        title: '地区代码',
        field: 'dq_dm',
        sortable: false,
        hidden: true
    }, {
        title: '地区名称',
        field: 'dq_mc',
        sortable: false,
        width: 100,
        formatter: function (value) {
            if (null == value) {
                value = "";
            }
            return "<span title='" + value + "'>" + value + "</span>";
        }
    }, {
        title: '当月社保费收入',
        field: 'dysbfsr_je',
        sortable: false,
        width: 100,
        formatter: function (value) {
            if (null == value) {
                value = "";
            }
            return "<span title='" + value + "'>" + value + "</span>";
        }
    }, {
        title: '当月社保费同比增减',
        field: 'dysbftbzj_je',
        sortable: false,
        width: 100,
        formatter: function (value) {
            if (null == value) {
                value = "";
            }
            return "<span title='" + value + "'>" + value + "</span>";
        }
    }, {
        title: '当年累计社保费收入',
        field: 'dnsbfsr_je',
        sortable: false,
        width: 100,
        formatter: function (value) {
            if (null == value) {
                value = "";
            }
            return "<span title='" + value + "'>" + value + "</span>";
        }
    }, {
        title: '当年累计社保费同比增减',
        field: 'dnsbftbzj_je',
        sortable: false,
        width: 100,
        formatter: function (value) {
            if (null == value) {
                value = "";
            }
            return "<span title='" + value + "'>" + value + "</span>";
        }
    }]];

    $('#tt').datagrid({
        collapsible: false,
        rownumbers: true,
        remoteSort: false,
        nowrap: true,
        striped: true,
        fitColumns: true,
        singleSelect: true,
        fit: false,
        pagination: false,
        columns: fields
    });
}

function queryGwLb() {
    qqcs = {};
    $.ajax({
        url: "/portal/query/query16/queryData.do",
        data: qqcs,
        type: "post",
        timeout: sys_timeout,
        dataType: "json",
        async: false,
        error: function (XMLHttpRequest, textStatus) {
        },
        success: function (respText) {
            if (checkResponse(respText)) {
                var data = respText.repData.data;
                if (null != data) {
                    $('#tt').datagrid('loadData', data);
                    $('#tt').datagrid('autoSizeColumn');
                }
            }
            else {
                innerToast.warn(respText.msg);
            }
        }
    });
}